# -*- coding:utf-8 -*-
"""
@file: err.py
@Description: 错误异常处理机制
@author: Yu Wenjie
@email : yuwenjie@cetc-cloud.com
@version: 
@date: 2017/10/17 16:08
"""
import logging

#类的继承关系
class FooError(StandardError):
    pass


def foo(s):
    n = int(s)
    if n == 0:
        raise FooError("invalid value:%s" % s)
    return 10 / int(s)


def bar(s):
    return foo(s) * 2


def main():
    try:
        bar("0")
    except StandardError, e:
        logging.exception(e)


if __name__ == '__main__':
    main()
    print "END"
